//package com.ruoyi.web.rabbitmq;
//
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.BeansException;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//import org.springframework.context.annotation.Configuration;
//
////设置 生产者 确认机制
//
//@Configuration
//public class RabbitMqConfig implements ApplicationContextAware {
//    @Override
//    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//        //从spring容器中获取rabbitTemplate
//        RabbitTemplate rabbitTemplate=applicationContext.getBean(RabbitTemplate.class);
//        //rabbitTemplate设置ReturnCallBack
//        rabbitTemplate.setReturnCallback(new RabbitTemplate.ReturnCallback() {
//            @Override
//            public void returnedMessage(Message message, int i, String s, String s1, String s2) {
//                rabbitTemplate.convertAndSend(s2, message);
//            }
//        });
//
//
//    }
//}
